package com.copa.l2395;

import java.util.HashSet;
import java.util.Set;

/**
 * @author copa
 * @createDate 2023-03-26 12:08
 * @function set集合方法
 */
public class Test1 {

    public boolean findSubarrays(int[] nums) {
        Set<Integer> set = new HashSet<>();
        int n = nums.length;
        int sum;
        for (int i = 0; i < n - 1; i++) {
            sum = nums[i] + nums[i + 1];
            if (!set.contains(sum)) {
                set.add(sum);
                continue;
            }
            return true;
        }
        return false;
    }

    public static void main(String[] args) {
        int[] nums = {4,2,4};
        System.out.println(new Test1().findSubarrays(nums));
    }
}
